print("Введите скобочную последовательность")
s=input()
s1=""
f=""
k=0
for i in range(len(s)):
    if s[i] in "({<[]>})":
        f += s[i]
print(f)
for i in range(len(f)):
    if f[i] in "({[<":
        s1 += f[i]
    elif len(s1)>0 and f[i]==')' and s1[-1]=='(':
        s1=s1[:-1]
    elif len(s1)>0 and f[i]==']' and s1[-1]=='[':
        s1=s1[:-1]
    elif len(s1)>0 and f[i]=='}' and s1[-1]=='{':
        s1=s1[:-1]
    elif len(s1)>0 and f[i]=='>' and s1[-1]=='<':
        s1=s1[:-1]
    else:
        k=1
        break
if len(s1)==0 and k==0:
    print("True")
else:
    print("False")
        